<template>
	<view class="main">
		<uni-nav-bar fixed left-icon="back" title="充值记录" color="#333333" backgroundColor="#FFFFFF" :border="false" statusBar
			@clickLeft="goReturn"></uni-nav-bar>
		<view class="zj-list">
			<view class="zj-detail" v-for="(item,index) in list" :key="index">
				<view class="left">
					<view class="name">{{item.desc}}</view>
					<view class="time">{{item.created_at}}</view>
				</view>
				<view class="right">
					<view class="num">+{{item.income}}</view>
				</view>
			</view>
			<view class="list-foot" @click="queryMore" v-if="!isBottom">
				加载更多
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:{
					pageNum:1,
					pageSize:10
				},
				isBottom:false
			}
		},
		methods: {
			//加载更多
			queryMore(){
				this.page.pageNum++
				this.queryData()
			},
			//查询
			queryData(){
				var url = '/v1/get_my_recharge?page='+this.page.pageNum+'&page_num=' + this.page.pageSize
				this.$http.get(url,res => {
					let data = res.data
					this.isBottom = this.page.pageNum = data.last_page || data.last_page == 0
					this.list = data.data
				})
			},
			// 返回
			goReturn() {
				uni.navigateBack({
					delta: 1
				});
			}
		},
		onLoad() {
			this.queryData()
		},
		onPullDownRefresh() {
			this.page.pageNum = 1
			this.list = []
			this.queryData()
		}
		
	}
</script>

<style lang="scss">
	.zj-list{
		width: 100%;
		.zj-detail{
			height: 120upx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #f2f2f2;
			.left{
				display: flex;
				flex-direction: column;
				.name{
					font-size: 28upx;
					//font-family: fantasy;
					color: #333333;
				}
				.time{
					font-size: 20upx;
					color: #999999;
				}
			}
			.right{
				display: flex;
				flex-direction: column;
				.num{
					font-size: 32upx;
					color: $blue;
				}
			}
		}
		.list-foot{
			height: 120upx;
			width: 100%;
			line-height: 120upx;
			color: #999999;
			font-size: 24upx;
			text-align: center;
		}
	}
</style>
